package com.source.lightfowl.person.dao;

import com.source.lightfowl.person.entity.Plate;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface PlateDao extends JpaRepository<Plate,String> {
    Plate findByPid(String pid);


    @Query(value = "select * from plate where pid in (select pid from role_plate where rid=?)",nativeQuery = true)
    List<Plate> findByRid(String rid);



    @Query(value = "select * from plate where ptype=?1 and bigpid=?2",nativeQuery = true)
    Plate findByPtypeAndBpid(String ptype, String bpid);

    /*
    @Modifying
    @Query(
            value = "INSERT INTO plate (`pid`,`pname`,`ptype`,`bigpid`) values(?1,?2,?3,?4)",
            nativeQuery = true
    )
    void addplate(String pid, String pname, String ptype, String bpid);

     */
}
